from django.db import models

# Create your models here.
from common.models import BaseModel


class Bottle(BaseModel):
    FLOWING_STATUS_ENUM = {
        "NOT_FLOWING": 0,
        "FLOWING": 1
    }
    FLOWING_STATUS_CHOICES = (
        (0, "未漂流"),
        (1, "漂流中")
    )
    title = models.CharField(max_length=32, null=False, verbose_name="标题", help_text="标题")
    content = models.TextField(null=False, verbose_name="内容", help_text="内容")
    likes = models.IntegerField(default=0, verbose_name="点赞数", help_text="点赞数")
    views = models.IntegerField(default=0, verbose_name="查看数", help_text="查看数")
    owner_id = models.IntegerField(null=True, verbose_name="漂流瓶当前主人", help_text="漂流瓶当前主人")
    pre_owner_id = models.IntegerField(null=True, verbose_name="漂流瓶上一任主人", help_text="漂流瓶上一任主人")
    create_user_id = models.IntegerField(null=True, verbose_name="漂流瓶创建者", help_text="漂流瓶创建者")
    update_user_id = models.IntegerField(null=True, verbose_name="漂流瓶更新者", help_text="漂流瓶更新者")
    is_flowing = models.SmallIntegerField(default=0, choices=FLOWING_STATUS_CHOICES, verbose_name="是否漂流中", help_text="是否漂流中")

    class Meta:
        db_table = "tb_bottle"
        verbose_name = "漂流瓶"
        verbose_name_plural = verbose_name

